package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 商品基本信息
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_goods`", autoResultMap = true)
public class LyGoods {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @Length(max = 63, message = "商品编号长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("商品编号")
    @TableField(value = "`goods_sn`")
    private String goodsSn;


    @Length(max = 127, message = "商品名称长度不能超过127位")
    @NotEmpty
    @ApiModelProperty("商品名称")
    @TableField(value = "`name`")
    private String name;


    @ApiModelProperty("所属类目ID")
    @TableField(value = "`category_id`")
    private Integer categoryId;


    @ApiModelProperty("ID")
    @TableField(value = "`brand_id`")
    private Integer brandId;


    @Length(max = 1023, message = "商品宣传图片列表，采用JSON数组格式长度不能超过1023位")
    @ApiModelProperty("商品宣传图片列表，采用JSON数组格式")
    @TableField(value = "`gallery`")
    private String gallery;


    @Length(max = 255, message = "商品关键字")
    @ApiModelProperty("商品关键字")
    @TableField(value = "`keywords`")
    private String keywords;


    @Length(max = 255, message = "商品简介长度不能超过255位")
    @ApiModelProperty("商品简介")
    @TableField(value = "`brief`")
    private String brief;


    @ApiModelProperty("是否上架")
    @TableField(value = "`is_on_sale`")
    private Integer isOnSale;


    @ApiModelProperty("ID")
    @TableField(value = "`sort_order`")
    private Integer sortOrder;


    @Length(max = 255, message = "商品图片长度不能超过255位")
    @ApiModelProperty("商品图片")
    @TableField(value = "`pic_url`")
    private String picUrl;


    @Length(max = 255, message = "商品分享朋友圈图片长度不能超过255位")
    @ApiModelProperty("商品分享朋友圈图片")
    @TableField(value = "`share_url`")
    private String shareUrl;


    @ApiModelProperty("是否新品首发，0：否 1：是")
    @TableField(value = "`is_new`")
    private Integer isNew;


    @ApiModelProperty("是否人气推荐，0：否 1：是")
    @TableField(value = "`is_hot`")
    private Integer isHot;


    @Length(max = 31, message = "单位长度不能超过31位")
    @ApiModelProperty("单位")
    @TableField(value = "`unit`")
    private String unit;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("专柜价格")
    @TableField(value = "`counter_price`")
    private BigDecimal counterPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("零售价格")
    @TableField(value = "`retail_price`")
    private BigDecimal retailPrice;


    @Length(max = 65535, message = "详细介绍长度不能超过65535位")
    @ApiModelProperty("详细介绍")
    @TableField(value = "`detail`")
    private String detail;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @NotNull
    @ApiModelProperty("浏览量")
    @TableField(value = "`browse`")
    private Integer browse;


    @NotNull
    @ApiModelProperty("已销售总量")
    @TableField(value = "`sales`")
    private Integer sales;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;


    @Length(max = 128, message = "供货单位长度不能超过128位")
    @ApiModelProperty("供货单位")
    @TableField(value = "`commpany`")
    private String commpany;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("批发价格")
    @TableField(value = "`wholesale_price`")
    private BigDecimal wholesalePrice;

}
